package account;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import service.IStaffService;
import common.BasePersistenceTest;
import entity.Company;
import entity.Staff;

public class PayTest extends BasePersistenceTest {

	@Test
	public void testStaffAndCompany() {
		Company companyA = new Company("Tencent");

		Staff staffA = new Staff(companyA);
		staffA.setName("xiaowang");

		Staff staffB = new Staff(companyA);
		staffB.setName("xiaoli");

		getPersistenceManager().save(companyA);
		assertEquals(2, companyA.getStaffs().size());
	}

	@Autowired
	private IStaffService staffService;

	@Test
	public void testStaffService() {

		Company companyA = new Company("Tencent");

		Staff staffA = new Staff(companyA);
		staffA.setName("xiaowang");

		Staff staffB = new Staff(companyA);
		staffB.setName("xiaoli");

		getPersistenceManager().save(companyA);

		assertEquals(2, staffService.getAllStaffs().size());
	}

}
